#include<iostream>


class Calculate
{
    public:
    virtual double func(double num1,double num2) = 0;

};


class Add :public Calculate
{
    double func(double num1,double num2)
    {
        return  num1 + num2 ;
    }

};


class Sub :public Calculate
{
    double func(double num1,double num2)
    {
        return  num1 - num2;
    }

};



class Mul :public Calculate
{
    double func(double num1,double num2)
    {
        return  num1 * num2 ;
    }

};

class Div :public Calculate
{
    double func(double num1,double num2)
    {
        if(num1 == 0 || num2==0)
        {   std::cout<<"除数和被除数有至少一个 为 0"<<std::endl;
            return 0;
        }
        return  num1 / num2;
    }

};





int main()
{
    // //加法
    // Calculate* add = new Add;
    // std::cout<<add->func(1,2)<<std::endl;
    // delete add;

    // //减法
    // Calculate* sub = new Sub;
    // std::cout<<sub->func(1,2)<<std::endl;
    // delete sub;

    // //乘法
    // Calculate* mul = new Mul;
    // std::cout<<mul->func(1,2)<<std::endl;
    // delete mul;

    // //整除 
    // Calculate* div = new Div;
    // std::cout<<div->func(1,2)<<std::endl;
    // delete div;




    return 0;
}